package app.engine.entitys;

import app.game.ChessPoint;

import java.util.Comparator;

/**
 * @Description 走法类，包含不可变的坐标和可变的评分
 * @Date 2022/4/18 20:59
 * @Created by LYP
 */
public class Move implements Comparable<Move> {

    public Move(int x, int y, int score) {
        this.x = x;
        this.y = y;
        this.score = score;
    }

    private int x;

    private int y;

    private int score;

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public ChessPoint getChessPoint() {
        return new ChessPoint(this.x, this.y);
    }

    @Override
    public String toString() {
        return "["+x+","+y+"]";
    }


    public boolean equals(Move move) {
        return move.x == this.x && move.y == this.y;
    }

    @Override
    public int compareTo(Move move) {
        return move.getScore() - this.score;
    }
}
